package funjava;

/**
 * Created by judasnow on 5/25/16.
 */

interface IntSequence2 {
    boolean hasNext();
    int next();

    static IntSequence2 constant(int i) {
        class R implements IntSequence2 {
            int i;

            public R(int i) {
                this.i = i;
            }

            @Override
            public boolean hasNext() {
                return true;
            }

            @Override
            public int next() {
                return 1;
            }
        }

        return new R(i);
    }
}

public class C3_5 {
    public static void main(String[] args) {
        IntSequence2 seq = IntSequence2.constant(2);
    }
}
